
#pragma once

#include "stdafx.h"

#include <string>
#include <map>

#include "demos.h"

using namespace std;

class TessWaveMesh : public IMesh {
    const ModelBlock* m_uniformModel;

    float m_dt, m_dh, m_c;
    int m_currentFrame;

    GLsizei m_waveWidth, m_waveHeight;

    GLuint m_flowProg, m_drawProg, m_filtProg;

    // textures
    GLuint m_waves[4];
    GLuint m_wavePresent;
    GLuint m_filtTex, m_lambdaTex;

    // flow program
    GLint m_flowPosition;
    GLint m_wave_t, m_wave_prev_t, m_lambda;

    // filter program
    GLint m_filtPos;
    GLint m_filtWave, m_filtDir, m_filtConst;

    // draw program
    GLint m_drawPosition;
    GLint m_drawWave, m_scaleBump;

    GLuint m_fbo;
public:
    TessWaveMesh(const char* nTex, float dt, float dh, float c);
    ~TessWaveMesh();
    void Draw(GLsizei width, GLsizei height);
    void AttachUniforms(const UniformMap& uBlocks);
};
